/* model */
import Field from '@model/entity/Field'
import { CardSpecialfromEnum } from '@model/enum/CardEnum'

class CardInfoConfig {
  export: boolean = false
}

// 附件组件信息 连接器配置
interface CardInfoConnectorConfig extends CardInfoConfig {
  connectorInfo: CardInfoConnectorInfo;
}

interface CardInfoConnectorInfo {
  fromBizType: string;
  fromBizTypeId: string;
  toBizType: string;
  toBizTypeId: string;
  isToThird?: boolean;
  toAppName?: string;
  toAppType?: string
}

// TODO: 泛型 config
class CardInfo {
  // 卡片id
  cardId: string = ''
  // 卡片名称
  cardName: string = ''
  name: string = ''
  // 输入类型
  inputType: string = ''
  // 字段列表
  fields: Field[] = []
  // 是否可以读取
  canRead: boolean = false
  // 是否可以修改
  canWrite: boolean = false
  // 是否可以新建
  canCreate: boolean = false
  // 是否可以删除
  canDelete: boolean = false
  // 特殊来源
  specialfrom?: string | null = null
  // 默认配置
  config: string | undefined | null | CardInfoConfig | CardInfoConnectorConfig = null
  // 当前状态是否可以编辑
  stateCanEdit?: string[] | null;
}

export {
  CardInfoConfig,
  CardInfoConnectorConfig,
  CardInfoConnectorInfo
}

export default CardInfo
